/*
 * IntegerLiteralAst.cpp
 *
 *  Created on: 3 Nov 2010
 *      Author: kn308
 */

#include <MAlice/Parser/location.hh>
#include <MAlice/MAlice.h>
#include <MAlice/Codegen.h>
#include <MAlice/Ast/IntegerLiteralAst.h>

#include <llvm/Constants.h>

namespace MAlice
{

IntegerLiteralAst::IntegerLiteralAst(location loc, int value) :
	LiteralAst(loc), mValue(value)
{
	MALICE_TRACE;
}

IntegerLiteralAst::~IntegerLiteralAst()
{
	MALICE_TRACE;
}

llvm::Value* IntegerLiteralAst::generate()
{
	MALICE_TRACE;
#	ifndef NDEBUG
	cout << "IntegerLiteralAst::generate()" << endl;
#	endif
	const Type* int32 = Type::getInt32Ty(Codegen::get()->getContext());
	return ConstantInt::get(int32, mValue, true);
}

}
